﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SendProblem.aspx.cs" Inherits="Page_DutyAction_SendProblem" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>报修信息</title>
    <%--layui--%>
    <link href="../../layui/css/layui.css" rel="stylesheet" />
    <script src="../../layui/layui.js"></script>

    <script src="../../Scripts/jquery-1.8.0.min.js"></script>
    <script src="../../Scripts/jquery.form.js"></script>
</head>
<body>
    <form class="layui-form" action="" id="AddForm" style="padding-right: 10px; padding-top: 10px;" enctype="multipart/form-data" method="post">

        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请填写简要描述，例如“电脑无法开机”" class="layui-input" id="title" value="" />
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">问题描述</label>
            <div class="layui-input-block">
                <textarea name="details"  lay-verify="required"  class="layui-textarea" placeholder="请输入问题描述，例如“电脑，点击开机键没反应，电脑黑屏”"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">故障图片</label>
            <div class="layui-input-block">
                <input type="file" name="file" class="layui-upload-file" lay-title="添加一个故障图片">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" id="problemImgDiv" style="display: none">
                <img class="problemImg" src="" width="200px" height="200px" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">工号</label>
            <div class="layui-input-block">
                <input type="text" name="card" lay-verify="required" autocomplete="off" class="layui-input" id="card" value="" placeholder="请输入报修人工号" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">单选框</label>
            <div class="layui-input-block">
                <input type="radio" name="sex" value="0" title="普通" checked>
                <input type="radio" name="sex" value="1" title="重要">
                <input type="radio" name="sex" value="2" title="紧急">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">联系人</label>
            <div class="layui-input-block">
                <input type="text" name="name" lay-verify="required" autocomplete="off" class="layui-input" id="name" value="" placeholder="请输入联系人" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">联系电话</label>
            <div class="layui-input-block">
                <input type="text" name="phone" lay-verify="required" autocomplete="off" class="layui-input" id="phone" value="" placeholder="请输入联系电话" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">报修地址</label>
            <div class="layui-input-block">
                <input type="text" name="address" lay-verify="required" autocomplete="off" class="layui-input" id="address" value="" placeholder="请输入报修地址" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">类别</label>
            <div class="layui-input-inline">
                <select name="quiz1" lay-verify="required"  lay-filter="formDemo">
                    <option value="">请选择问题类别</option>
                    <option value="浙江">浙江省</option>
                    <option value="你的工号">江西省</option>
                    <option value="你最喜欢的老师">福建省</option>
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="quiz2"  lay-filter="formDemo">
                    <option value="">请选择问题类别</option>
                    <option value="杭州">杭州</option>
                    <option value="温州">温州</option>
                    <option value="温州">台州</option>
                    <option value="温州">绍兴</option>
                </select>
            </div>
            <div class="layui-input-inline">
                <select name="quiz3"  lay-filter="formDemo">
                    <option value="">请选择问题类别</option>
                    <option value="西湖区">西湖区</option>
                    <option value="余杭区">余杭区</option>
                    <option value="拱墅区">临安市</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="formDemo">提交</button>
            </div>
        </div>


    </form>



    <script>
        //表单提交完成
        function showResponse(data, status) {
            if (data.status == 1) {
                layer.msg(data.info, {
                    time: 1000 //2秒关闭（如果不配置，默认是3秒）
                });

            }
            else {
                layer.msg(data.info, {
                    time: 1000 //2秒关闭（如果不配置，默认是3秒）
                });
            }
        }

        //Demo
        layui.use('form', function () {
            var form = layui.form();


            form.on('select', function (data) {
                console.log(data.value); //得到被选中的值
            });
            

            //监听提交
            form.on('submit(formDemo)', function (data) {
                var OrderId = $(".orderId").val();
                var option = {
                    dataType: 'json',
                    url: '/Handler/TestHandler.ashx?Action=GetOrderInfo&OrderId=' + OrderId,
                    success: showResponse
                };
                $('#AddForm').ajaxForm(option);
            });


        });

        layui.use('upload', function () {
            layui.upload({
                url: '/Handler/UploadHandler.ashx?action=UploadTopicImage&type=problemImage'
              , method: 'post' //上传接口的http类型
              , success: function (res) {
                  $(".problemImg").attr('src', res.msg);
                  $("#problemImgDiv").show();

              }
            });
        });

       
       
       
    </script>
</body>
</html>
